//
//  SearchDetailCollectionViewCell.m
//  Menu
//
//  Created by dllo on 15/7/6.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "SearchDetailCollectionViewCell.h"

@implementation SearchDetailCollectionViewCell

- (void)dealloc
{
    [_itemImgView release];
    [_titleLabel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews
{
    self.itemImgView = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x + 5*WIDTH, self.contentView.frame.origin.x +5*HEIGHT, 160*WIDTH, 90*HEIGHT)];
    //    self.itemImage.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.itemImgView];
    [_itemImgView release];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y + 90*HEIGHT, 170*WIDTH, 30*HEIGHT)];
    //    self.titleLabel.backgroundColor = [UIColor lightGrayColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLabel];
    [_titleLabel release];
}

-(void)setSearchModel:(SearchDetailModel *)searchModel
{
    if (_searchModel != searchModel)
    {
        [_searchModel release];
        _searchModel = [searchModel retain];
    }
    self.titleLabel.text = searchModel.name;
    [self.itemImgView sd_setImageWithURL:[NSURL URLWithString:self.searchModel.imagePath]];
}















@end
